package com.synygy.bdviewer.dao;

import com.synygy.bdviewer.util.QueryParam;
import com.synygy.bdviewer.model.STIObject;

import java.util.Iterator;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Popovici
 * Date: Oct 18, 2008
 * Time: 7:16:56 PM
 * To change this template use File | Settings | File Templates.
 */
public interface STIObjectDao {
    /**
	 * Load a {@link com.synygy.bdviewer.model.STIObject} from the DB, given it's <tt>id</tt>.
	 *
	 * @param id
	 *            The id of the StiObject to load.
	 * @return StiObject
	 */
	STIObject load(int id);

	/**
	 * Save the StiObject to the DB
	 *
	 * @param stiObject
	 * @return persistent instance of StiObject
	 */
	STIObject save(STIObject stiObject);

	/**
	 * Delete a {@link STIObject} from the DB, given it's <tt>id</tt>.
	 *
	 * @param id
	 *            The id of the StiObject to delete.
	 */
	void delete(int id);

	/**
	 * Query the DB, using the supplied query details.
	 *
	 * @param qp
	 *            Query Paramaters to use.
	 * @return The results of the query as an Iterator.
	 */
	Iterator<STIObject> find(QueryParam qp, STIObject filter);

	/**
	 * Return the number of StiObjects in the DB.
	 *
	 * @return count
	 */
	int count(STIObject filter);

	/**
	 * Returns the list of all unique last names in the database
	 *
	 * @return the list of all unique last names in the database
	 */
	List<String> getUniqueLastNames();
}
